<?php


namespace app\api\model\Video;


use think\facade\Db;
use think\Model;

class VideoLikeModel extends Model
{

    /**
     * 数据表名
     * @var string
     */
    protected $name = "video_like";

    /**
     * 查询一条
     * @param $where
     * @return array|Model|null
     * @throws
     */
    public static function getVideoLikeWhere($where)
    {
        $like = Db::name("video_like")->where($where)->find();
        return $like;
    }

    /**
     * 统计总数
     * @param $where
     * @return int
     */
    public static function getVideoLikeCountWhere($where)
    {
        $count = Db::name("video_like")->where($where)->count('id');
        return $count;
    }

    /**
     * 更新
     * @param $where
     * @param $save
     * @return int
     * @throws
     */
    public static function updateVideoLikeWhere($where,$save)
    {
        $flag = Db::name("video_like")->where($where)->update($save);
        return $flag;
    }

    /**
     * 添加
     * @param $data
     * @return int|string
     */
    public static function addVideoLike($data)
    {
        $id = Db::name("video_like")->insertGetId($data);
        return $id;
    }

}